package com.liyujie.dyeingmachine.mobile.dao;

import com.liyujie.dyeingmachine.mobile.entity.CylinderBlockEntity;
import com.raizlabs.android.dbflow.sql.language.SQLite;

import java.util.List;

public class CylinderBlockEntityDao {


    private CylinderBlockEntityDao() {
    }

    public static CylinderBlockEntityDao getInstance() {
        return CylinderBlockEntityDao.SingletonHolder.INSTANCE;
    }

    /**
     * 获取所有数据
     *
     * @return
     */
    public List<CylinderBlockEntity> getAllList() {
        return SQLite
                .select()
                .from(CylinderBlockEntity.class)
                .queryList();
    }

    /**
     * 获取全部数量
     */
    public long GetFullQuantity() {
        return SQLite.selectCountOf().from(CylinderBlockEntity.class).count();
    }

    /**
     * 清理所有数据
     */
    public void CleanAllData() {
        //
        SQLite.delete().from(CylinderBlockEntity.class).execute();
    }


    private static final class SingletonHolder {
        private static final CylinderBlockEntityDao INSTANCE = new CylinderBlockEntityDao();
    }
}
